4845eeb2833beca5a2379b39312012c75a04280f,template-core/src/test/java/com/squarespace/template/plugins/CoreFormattersTest.java,CoreFormattersTest,testApplyPartialErrorSafe,#,113

Before Change


    String partials = "\"block\": \"{.section foo}{@}\"}";
    Instruction inst = compiler().compile(template).code();
    Context ctx = new Context(JsonUtils.decode(input));
    ctx.setCompiler(compiler());
    ctx.setSafeExecution();
    ctx.setPartials(JsonUtils.decode(partials));
    ctx.execute(inst);

After Change


  public void testApplyPartialErrorSafe() throws CodeException {
    String template = "{@|apply block}";
    String partials = "{\"block\": \"{@|no-formatter}\"}";
    Context ctx = compiler().newExecutor()
        .template(template)
        .partialsMap(((ObjectNode)JsonUtils.decode(partials)))
        .json("123")
        .safeExecution(true)
        .execute();
    assertEquals(ctx.getErrors().size(), 1);
    assertEquals(ctx.getErrors().get(0).getType(), COMPILE_PARTIAL_SYNTAX);
  }